"; if (!$db->PConnect($db_host, $db_username, $db_password, $database)) { echo "could not connect to database"; exit; } } else { //echo " No Persistent Connection
"; if (!$db->Connect($db_host, $db_username, $db_password, $database)) { echo "could not connect to database"; exit; } } if (($_REQUEST["image"]) and (is_numeric($_REQUEST["image"]))) { if ($size == 1) $sql_query = "SELECT thumb_file FROM geodesic_classifieds_images WHERE image_id = ".$_REQUEST["image"]; else $sql_query = "SELECT filetype,image_file FROM geodesic_classifieds_images WHERE image_id = ".$_REQUEST["image"]; $result = $db->Execute($sql_query); if (!$result) { //echo 'Error
'; exit; } elseif ($result->RecordCount() == 1) { $show = $result->FetchNextObject(); if ($size == 1) { header("Content-Type: image/pjpeg"); echo $show->THUMB_FILE; exit; } else { header("Content-Type: ".$show->FILETYPE); echo $show->IMAGE_FILE; exit; } } } elseif (($_REQUEST["popupimage"]) && (is_numeric($_REQUEST["popupimage"]))) { $sql_query = "SELECT popup_image_template_id,popup_image_extra_width,popup_image_extra_height, maximum_full_image_height, maximum_full_image_width FROM geodesic_classifieds_ad_configuration"; $ad_configuration_result = $db->Execute($sql_query); if ($debug_popup) echo $sql_query."
\n"; if (!$ad_configuration_result) { echo $sql_query."
\n"; exit; } elseif ($ad_configuration_result->RecordCount() == 1) { $ad_configuration = $ad_configuration_result->FetchNextObject(); $sql_query = "SELECT * FROM geodesic_classifieds_images_urls WHERE image_id = ".$_REQUEST["popupimage"]; if ($debug_popup) echo $sql_query."
\n"; $image_result = $db->Execute($sql_query); if (!$image_result) { echo $sql_query."
\n"; exit; } elseif ($image_result->RecordCount() == 1) { $show_image = $image_result->FetchNextObject(); if ((strlen(trim($show_image->IMAGE_URL)) > 0) && ($ad_configuration->POPUP_IMAGE_TEMPLATE_ID)) { //get template //place the image within the template $sql_query = "select template_code from geodesic_templates where template_id = ".$ad_configuration->POPUP_IMAGE_TEMPLATE_ID; if ($debug_popup) echo $sql_query."
\n"; $template_result = $db->Execute($sql_query); if (!$template_result) { echo $sql_query."
\n"; exit; } elseif ($template_result->RecordCount() ==1) { $show_template = $template_result->FetchNextObject(); $template = stripslashes($show_template->TEMPLATE_CODE); if ($debug_popup) { echo $image_width." is image width before
\n"; echo $image_height." is image height before
\n"; echo $ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH." is MAXIMUM_FULL_IMAGE_WIDTH
\n"; echo $ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT." is MAXIMUM_FULL_IMAGE_HEIGHT
\n"; echo $show_image->ORIGINAL_IMAGE_WIDTH." is ORIGINAL_IMAGE_WIDTH
\n"; } if (($show_image->ORIGINAL_IMAGE_WIDTH > $ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH) || ($show_image->ORIGINAL_IMAGE_HEIGHT > $ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT)) { if (($show_image->ORIGINAL_IMAGE_WIDTH > $ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH) && ($show_image->ORIGINAL_IMAGE_HEIGHT > $ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT)) { $imageprop = ($ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH * 100) / $show_image->ORIGINAL_IMAGE_WIDTH; $imagevsize = ($show_image->ORIGINAL_IMAGE_HEIGHT * $imageprop) / 100 ; $image_width = $ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH; $image_height = ceil($imagevsize); if ($image_height > $ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT) { $imageprop = ($ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT * 100) / $show_image->ORIGINAL_IMAGE_HEIGHT; $imagehsize = ($show_image->ORIGINAL_IMAGE_WIDTH * $imageprop) / 100 ; $image_height = $ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT; $image_width = ceil($imagehsize); } } elseif ($show_image->ORIGINAL_IMAGE_WIDTH > $ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH) { $imageprop = ($ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH * 100) / $show_image->ORIGINAL_IMAGE_WIDTH; $imagevsize = ($show_image->ORIGINAL_IMAGE_HEIGHT * $imageprop) / 100 ; $image_width = $ad_configuration->MAXIMUM_FULL_IMAGE_WIDTH; $image_height = ceil($imagevsize); } elseif ($show_image->ORIGINAL_IMAGE_HEIGHT > $ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT) { $imageprop = ($ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT * 100) / $show_image->ORIGINAL_IMAGE_HEIGHT; $imagehsize = ($show_image->ORIGINAL_IMAGE_WIDTH * $imageprop) / 100 ; $image_height = $ad_configuration->MAXIMUM_FULL_IMAGE_HEIGHT; $image_width = ceil($imagehsize); } else { $image_width = $show_image->ORIGINAL_IMAGE_WIDTH; $image_height = $show_image->ORIGINAL_IMAGE_HEIGHT; } } else { $image_width = $show_image->ORIGINAL_IMAGE_WIDTH; $image_height = $show_image->ORIGINAL_IMAGE_HEIGHT; } if ($debug_popup) { echo $image_width." is image width after
\n"; echo $image_height." is image height after
\n"; } $replace = ""; $template = str_replace("<>",$replace,$template); if ($debug_popup) echo $show_image->DISPLAY_ORDER." is this images display_order value
\n"; $sql_query = "select text_id,text from geodesic_pages_messages_languages where page_id = 157 and language_id = ".$language_id; if ($debug_popup) echo $sql_query."
\n"; $result = $db->Execute($sql_query); if (!$result) { echo ""; } elseif ($result->RecordCount() > 0) { //take the database message result and push the contents into an array while ($show = $result->FetchNextObject()) { $messages[$show->TEXT_ID] = $show->TEXT; //echo $show->TEXT_ID." - ".$show->TEXT."
\n"; } } if ($show_image->DISPLAY_ORDER == 1) { //this is the first image so there is no so replace previous link with nothing $template = str_replace("<>","",$template); $sql_query = "select * from geodesic_classifieds_images_urls where classified_id = ".$show_image->CLASSIFIED_ID." and display_order > ".$show_image->DISPLAY_ORDER." order by display_order asc limit 1"; $next_image_result = $db->Execute($sql_query); if ($debug_popup) echo $sql_query."
\n"; if (!$next_image_result) { echo ""; } elseif ($next_image_result->RecordCount() == 1) { //get text for popup image $next_image = $next_image_result->FetchNextObject(); //build link to next image $next_image_link = "IMAGE_ID.">". urldecode($messages[2412]).""; //get link to next image if there is one $template = str_replace("<>",$next_image_link,$template); } else { //cannot find next image so replace next image link with nothing //possibly only one image attached to this ad $template = str_replace("<>","",$template); } } else { //get link to previous image if there is one $sql_query = "select * from geodesic_classifieds_images_urls where classified_id = ".$show_image->CLASSIFIED_ID." and display_order > ".$show_image->DISPLAY_ORDER." order by display_order asc limit 1"; $next_image_result = $db->Execute($sql_query); if ($debug_popup) echo $sql_query."
\n"; if (!$next_image_result) { $template = str_replace("<>","",$template); } elseif ($next_image_result->RecordCount() == 1) { $next_image = $next_image_result->FetchNextObject(); $next_image_link = "IMAGE_ID.">". urldecode($messages[2412]).""; $template = str_replace("<>",$next_image_link,$template); } else $template = str_replace("<>","",$template); //get link to next image if there is one $sql_query = "select * from geodesic_classifieds_images_urls where classified_id = ".$show_image->CLASSIFIED_ID." and display_order < ".$show_image->DISPLAY_ORDER." order by display_order desc limit 1"; $previous_image_result = $db->Execute($sql_query); if ($debug_popup) echo $sql_query."
\n"; if (!$previous_image_result) { $template = str_replace("<>","",$template); } elseif ($previous_image_result->RecordCount() == 1) { $previous_image = $previous_image_result->FetchNextObject(); $previous_image_link = "IMAGE_ID.">". urldecode($messages[2411]).""; $template = str_replace("<>",$previous_image_link,$template); } else $template = str_replace("<>","",$template); } echo $template; exit; } else { echo ""; exit; } } elseif (strlen(trim($show_image->IMAGE_URL)) > 0) { //display image only echo ""; exit; } else { //no image to display } } else { //check uploaded image type??? $sql_query = "SELECT * FROM geodesic_classifieds_images WHERE image_id = ".$_REQUEST["popupimage"]; if ($debug_popup) echo $sql_query."
\n"; $image_result = $db->Execute($sql_query); if (!$image_result) { echo $sql_query."
\n"; exit; } elseif ($image_result->RecordCount() == 1) { } else { //no image to display } } } else exit; } ?>